513A - Game - CodeForces Solution


constructive algorithms math *800

Please click on ads to support us..

Python Code:

s=input()
lst=s.split()
n1=int(lst[0])
n2=int(lst[1])
k1=int(lst[2])
k2=int(lst[3])
if n1>n2:
    print("First")
else:
    print("Second")

C++ Code:

#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<char> vc;
typedef long long ll;
#define sq(a) (a)*(a)
#define pb push_back
#define pob pop_back
#define MOD 1000000007
#define sz(x) (int)x.size()
#define FOR(i, j, k) for(i = j;i < k;i++)
void odd_even(int num)
{
    if(num & 1) cout << "odd";//last bit is 1
    if(~num & 1) cout << "even";//last bit is 0
}
void solve(int ind){
   int n1, n2, k1, k2;
   cin >> n1 >> n2 >> k1 >> k2;
   bool turn = 0;
   bool p = 1;
   while(p) {
        if(!turn) {
            if(n1==0) {
                p = 0; 
            }
            else {n1-=1;turn=1;}
        }
        else {
            if(n2==0) {
                p = 0;
            }
            else {n2-=1;turn=0;}
        }
   }
   if(!turn) cout << "Second";
   else cout << "First";
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tt=1, k = 1;
    //cin >> tt;
    while(tt--) {
        solve(k);
        k++;
        cout << "\n";
    }

    /*while(scanf("%d %d", &a, &b)!=EOF){
            //fill it in
    }*/
    //solve(0);
    //exception_handle();

}


  		       	   				 	 	 	 		 	


Comments

Submit
0 Comments
More Questions

1335A - Candies and Two Sisters
96B - Lucky Numbers (easy)
1151B - Dima and a Bad XOR
1435B - A New Technique
1633A - Div 7
268A - Games
1062B - Math
1294C - Product of Three Numbers
749A - Bachgold Problem
1486B - Eastern Exhibition
1363A - Odd Selection
131B - Opposites Attract
490C - Hacking Cypher
158B - Taxi
41C - Email address
1373D - Maximum Sum on Even Positions
1574C - Slay the Dragon
621A - Wet Shark and Odd and Even
1395A - Boboniu Likes to Color Balls
1637C - Andrew and Stones
1334B - Middle Class
260C - Balls and Boxes
1554A - Cherry
11B - Jumping Jack
716A - Crazy Computer
644A - Parliament of Berland
1657C - Bracket Sequence Deletion
1657B - XY Sequence
1009A - Game Shopping
1657A - Integer Moves